#! /usr/bin/python

count = 99
bouncy = set()
for i in range(1, 100):
    bouncy.add(i)
for a0 in range(10):
    for a1 in range(a0, 10):
	for a2 in range(a1, 10):
	    n = a0 + a1*10 + a2*100
	    nr = a2 + a1*10 + a0*100
	    bouncy.add(n)
	    bouncy.add(nr)
	    if n%10 == 0 and n != 0:count += 1
	    elif a0 == a1 and a0 == a2 and n != 0: count += 1
	    elif n != 0: count += 2

#print len(bouncy), count

for a0 in range(10):
    for a1 in range(a0, 10):
	for a2 in range(a1, 10):
	    for a3 in range(a2, 10):	        
		n = a0 + a1*10 + a2*100 + a3*1000
		nr = a3 + a2*10 + a1*100 + a0*1000
		bouncy.add(n)
		bouncy.add(nr)
         	if n%10 == 0 and n != 0:count += 1
		elif a0 == a1 and a0 == a2 and a0 == a3 and n != 0: count += 1
	        elif n != 0: count += 2		

for a0 in range(10):
    for a1 in range(a0, 10):
	for a2 in range(a1, 10):
	    for a3 in range(a2, 10):
		for a4 in range(a3, 10):
		    n = a0 + a1*10 + a2*100 + a3*1000 + a4*10000
		    nr = a4 + a3*10 + a2*100 + a1*1000 + a0*10000
		    bouncy.add(n)
		    bouncy.add(nr)
         	    if n%10 == 0 and n != 0:count += 1
		    elif a0 == a1 and a0 == a2 and a0 == a3 and a0 == a4 and n != 0: count += 1
	            elif n != 0: count += 2

for a0 in range(10):
    for a1 in range(a0, 10):
	for a2 in range(a1, 10):
	    for a3 in range(a2, 10):
		for a4 in range(a3, 10):
		    for a5 in range(a4, 10):
		        n = a0 + a1*10 + a2*100 + a3*1000 + a4*10000 + a5*100000
		        nr = a5 + a4*10 + a3*100 + a2*1000 + a1*10000 + a0*100000
		        bouncy.add(n)
		        bouncy.add(nr)
         	        if n%10 == 0 and n != 0:count += 1
		        elif a0 == a1 and a0 == a2 and a0 == a3 and a0 == a4 and a0 == a5 and n != 0: count += 1
	                elif n != 0: count += 2

for a0 in range(10):
    for a1 in range(a0, 10):
	for a2 in range(a1, 10):
	    for a3 in range(a2, 10):
		for a4 in range(a3, 10):
		    for a5 in range(a4, 10):
			for a6 in range(a5, 10):
		            n = a0 + a1*10 + a2*100 + a3*1000 + a4*10000 + a5*100000+1000000*a6
		            nr = a6 + a5*10 + a4*100 + a3*1000 + a2*10000 + a1*100000 + a0*1000000
		            bouncy.add(n)
		            bouncy.add(nr)
         	            if n%10 == 0 and n != 0:count += 1
		            elif a0 == a1 and a0 == a2 and a0 == a3 and a0 == a4 and a0 == a5 and a0 == a6 and n != 0: count += 1
	                    elif n != 0: count += 2	

bouncy.remove(0)
bl = []
for b in bouncy:
    bl.append(b)
bl.sort()

for i in range(bl.index(22000), len(bl)):
    p = (bl[i] - (i+1))/float(bl[i])
    if p > 0.98991 and p <= 0.99:
       for j in range(bl[i]+1, bl[i+1]):
	   pp = (j - (i+1))*100
	   #print p
	   if pp%j == 0 and pp/j == 99:
              print j, pp
              break
print count, len(bl)





















